-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement max duration of HTTP ConnectionPools #5801
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads a lot easier.
Not many changes to multiplex needed?
Some unit tests would be next step (if @sbordet likes this approach)
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Outdated
Show resolved
Hide resolved
@joakime This PR can be considered a draft of what needs to be done, but it's not yet functional. There's a new concept that the connection pool now needs to deal with: the fact that the pool can now contain a connection that is unusable because it expired. I'm busy writing some tests that expose this behavior, and they're miserably failing ATM. |
@lorban I'd really like the Pool to not need to know about expiry and it should all be done in the ConnectionPool. |
44bc3ef
to
302aad5
Compare
@gregw as discussed, this is what's going to happen. I've just closed the pool PR to reflect this. |
302aad5
to
24d97b8
Compare
Side note: while working on this, I noticed thatthe low-level pool was missing one bug fix for did not make it to the 9.4.x branch, and some closing behavior was not well tested. Maybe that should be moved to a different PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me
24d97b8
to
5b8246f
Compare
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Outdated
Show resolved
Hide resolved
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Outdated
Show resolved
Hide resolved
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorban as discussed, ConnectionHolder
leaks as a type parameter to subclass constructors, which is not ideal.
Let's give a go at making Pool.Entry
implement Attachable
and store the duration inside that attachment, so the implementation is completely hidden in AbstractConnectionPool
.
If maxDuration
is disabled, we don't even attach anything, and we save an allocation.
@sbordet Since I went that route as I find it cleaner, even if that means an unnecessary extra allocation when expiration isn't configured. |
ab57c63
to
e6ca0d9
Compare
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Outdated
Show resolved
Hide resolved
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Show resolved
Hide resolved
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Show resolved
Hide resolved
jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Outdated
Show resolved
Hide resolved
...ansport/src/test/java/org/eclipse/jetty/http2/client/http/MultiplexedConnectionPoolTest.java
Show resolved
Hide resolved
@@ -105,6 +109,27 @@ protected void doStop() throws Exception | |||
return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); | |||
} | |||
|
|||
/** | |||
* Get the max usage duration in milliseconds of the pool's connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap with <p>
.
d9a09f5
to
0dec883
Compare
Closes #5799